#ifndef _UNIT_H_
#define _UNIT_H_

#include "Amount.h"
#include <string>
#include <list>

class Unit
{
public:    
    int getRatePerBaseUnit()  const;
    std::string getName() const;
    virtual const Unit& getBaseUnit() const = 0;

protected:
    Unit(int ratePerBaseUnit, std::string name);
    
private:
    int ratePerBaseUnit;
    std::string name;
};

#define GET_UNIT(unit) \
    get##unit()


/////////////////////////////////////////////////////////////////////
class UnitVisitor;
class SequenceUnits
{
public:
    void addUnit(const Unit& unit);
    void accept(const UnitVisitor& visitor) const;

private:
    void sort();
    
private:
    typedef std::list<const Unit&> Units;
    Units units;
};

#endif
